<!--
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2022-12-02 17:04:52
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-02-06 09:23:05
 * @FilePath: \cxl-h5\src\components\expire-time.vue
-->

<template>
    <div>时间是否过期 {{ expire }}</div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
const expireTime = (time: string) => {
    var strtime = time.replace('/-/g', '/') //时间转换
    //时间
    var date1 = new Date(strtime)
    //现在时间
    var date2 = new Date()
    //判断时间是否过期
    return date1 < date2 ? true : false
}
const expire = ref(expireTime('2023-12-28'))
</script>

<style scoped lang="scss"></style>
